package com.example.controller;

import com.example.entity.SystemUser;
import com.example.dao.authMgmt.SystemUserDao;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/auth/systemUser")
@Api("用户相关接口")
public class SystemUserController {

    @Autowired
    private SystemUserDao systemUserDao;

    @PostMapping
    @ApiOperation("创建用户信息")
    public void insert(@RequestBody SystemUser systemUser) {
        systemUserDao.insert(systemUser);
    }

    @GetMapping("/load/{userId}")
    @ApiOperation("通过userId获取用户信息")
    public SystemUser load(@PathVariable("userId") Integer userId) {
        return systemUserDao.findOne(userId);
    }
}
